
import axios from 'axios'

let config = {
    baseUrl:"",
    timeout:30000,
    withCredentials: false
}

const _axios = axios.create(config);

// console.log(_axios.defaults)

_axios.interceptors.request.use(
    function(config){
        return config;
    },
    function(error){
        return Promise.reject(error)
    }
)

_axios.interceptors.response.use(
    function(response){
        return response.data;
    },
    function(error){
        return Promise.reject(error)
    }
)

export default{
    install:function(app:any,options:any){
        app.config.globalProperties.$axios = _axios;

        app.config.globalProperties.$translate = (key: any) => {
            return key
        }
    }
}